package com.jeecg.demo.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecgframework.jwt.util.ResponseMessages;
import org.jeecgframework.jwt.util.Results;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Api(value = "Highway", description = "公路-用户同步", tags = "Highway")
@Controller
@RequestMapping("/Highway")
public class Highway {
    @Autowired
    private SystemService systemService;

    /**
     * 公路-用户同步
     */
    @RequestMapping(value = "/market",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "用户同步", produces = "application/json")
    public ResponseMessages<List<Map<String, Object>>> market(HttpServletRequest request) {
        String sql = " SELECT\n" +
                "\ttr.FULLNAME AS \"companyName\",\n" +
                "\tsys.LOGINNAME AS \"userName\",\n" +
                "\tsys.PASSWORD AS \"password\"\n" +
                "FROM\n" +
                "\tSYS_USER sys\n" +
                "LEFT JOIN\n" +
                "  TRADER tr\n" +
                "ON\n" +
                "\tsys.ORGID = tr.TRADERID ";
        List<Map<String, Object>> listMap = systemService.findForJdbc(sql);
        return Results.success(listMap);
    }
}
